package com.unionpay.upyzt.model;

import com.unionpay.upyzt.exception.UpyztException;
import com.unionpay.upyzt.net.APIResource;
import com.unionpay.upyzt.resp.BalanceFreezeResp;
import java.util.Map;
import lombok.experimental.Accessors;

/**
 * 可提现余额冻结/解冻
 */
@Accessors(chain = true)
public class BalanceFreeze extends APIResource {

    /**
     * 可提现余额冻结/解冻
     *
     * @param params 请求参数
     * @return 冻结/解冻结果
     * @throws UpyztException 异常
     */
    public static BalanceFreezeResp balanceFreeze(Map<String, Object> params) throws UpyztException {
        return APIResource
            .request(RequestMethod.POST,
                classURL(BalanceFreeze.class), params,
                BalanceFreezeResp.class, null);
    }

    /**
     * 可提现余额冻结/解冻查询
     *
     * @param outOrderNo 平台订单号
     * @return 冻结/解冻结果
     * @throws UpyztException 异常
     */
    public static BalanceFreezeResp retrieveByOutOrderNo(String outOrderNo) throws UpyztException {
        return APIResource
            .request(APIResource.RequestMethod.GET,
                instanceURL(BalanceFreeze.class, outOrderNo), null,
                BalanceFreezeResp.class, null);
    }
}
